<!-- 管理员用户组新增和编辑页面 -->
<extend name="Public/base"/>
<block name="style">
    <link rel="stylesheet" type="text/css" href="__CSS__/theme.css" media="all">
</block>
<block name="body">
    <div class="main-title">
        <h2>{:lang("_SUBJECT_CONFIGURATION_")}</h2>
    </div>
    <div class="with-padding clearfix">
        <a href="{:Url('Admin/Theme/add')}" class="btn btn-success">{:lang("_INSTALL_A_NEW_THEME_")}</a>
        <a href="{:Url('Theme/tpls',array_merge($_GET,array('refresh'=>2)))}" class="btn btn-warning">
            <i class="icon-level-up"></i> {:lang("_CHECK_FOR_UPDATES_IMMEDIATELY_")}
        </a>
    </div>
    <div class="with-padding">
        <div class="cards plugin-list">
            <div class="col-xs-3">
                <div class="card">
                    <div class="media-wrapper">
                        <img src="__ROOT__/Public/images/preview.jpg" style="width:100%;">
                    </div>
                    <div class="card-heading">
                        <span class="pull-right">
                            <span class="label label-success" title={:lang("_THEME_VERSION_WITH_DOUBLE_")}>1.0.0</span>
                        </span>
                        <a href="{:Url('Admin/Theme/lookTheme',array('theme'=>'default'))}" target="_blank" title={:lang("_CHECK_THE_THEME_WITH_DOUBLE_")}>
                            <strong>MUUCMF{:lang("_SYSTEM_DEFAULT_THEME_")}</strong>
                        </a>
                    </div>
                    <div class="card-content text-muted" style="height: 64px;overflow:hidden">
                       {:lang("_BUILT_IN_MUUCMF_")} {:lang("_IN_THE_SYSTEM_IT_IS_THE_BASIS_OF_OTHER_TOPICS_")}
                    </div>
                    <div class="card-actions">
                        <div class="text-mute">
                           {:lang("_DEVELOPER_")}{:lang("_COLON_")}{:lang("_HOOMUU_WANTS_TO_DAY_MDT_INFOTECH_LTD_")}
                        </div>
                    </div>
                    <div class="card-actions">
                            <div class="text-mute">
                               {:lang("_TEMPLATE_FILE_NAME_")}{:lang("_COLON_")}Default
                            </div>
                        </div>
                    <div class="card-actions">
                        <ul class="nav nav-primary nav-justified nav-theme">
                            <eq name="now_theme" value="default">
                                <li class="active">
                                    <a><span >{:lang("_BASIC_THEME_")}</span> <span class="pull-right"><i class="icon icon-checked"></i></span></a>
                                </li>
                            <else/>
                                <li>
                                    <a class="btn btn-primary" data-role="use_this" data-value="default">{:lang("_USE_ONLY_THE_BASIC_THEMES_")}</a>
                                </li>
                            </eq>
                        </ul>
                    </div>
                </div>
            </div>
            <volist name="tplList" id="info">
                <div class="col-xs-3">
                    <div class="card">
                        <div class="media-wrapper">
                            <a data-role="use_this" data-value="{$info.file_name}">
                                <img src="{$info.path}/preview.jpg" style="width:100%;">
                            </a>
                        </div>
                        <div class="card-heading">
                        <span class="pull-right">
                            <span class="label label-success" title="{:lang("_THEME_VERSION_WITH_DOUBLE_")}">{$info.version} </span>
                            <empty name="info.update_list">
                                <else/>
                                <a style="text-decoration: none" href="javascript:void(0)" data-role="update_btn"
                                   data-type="ajax"
                                   data-url="{:Url('Cloud/getVersionList',array('token'=>$info['token']))}"
                                   data-toggle="modal" data-title={:lang("_A_NEW_VERSION_CAN_BE_UPDATED_WITH_DOUBLE_")}><span
                                        class=" label label-success ">{:lang("_THERE_IS_A_NEW_VERSION_")}{$info.update_list.0.title}</span></a>
                                <script>$(function () {
                                    $('[data-role="update_btn"]').tooltip('show');
                                });
                                </script>
                            </empty>
                        </span>
                            <a href="{:Url('Admin/Theme/lookTheme',array('theme'=>$info['file_name']))}" target="_blank" title="{:lang("_CHECK_THE_THEME_WITH_DOUBLE_")}">
                                <strong>{$info.title}</strong>
                            </a>
                        </div>
                        <div class="card-content text-muted" style="height: 64px;overflow:hidden;">
                            {$info.summary}
                        </div>
                        <div class="card-actions">
                            <div class="text-mute">
                               {:lang("_DEVELOPER_")}{:lang("_COLON_")}{$info.developer}
                            </div>
                        </div>
                        <div class="card-actions">
                            <div class="text-mute">
                               {:lang("_TEMPLATE_FILE_NAME_")}{:lang("_COLON_")}{$info.file_name}
                            </div>
                        </div>
                        <div class="card-actions">
                            <ul class="nav nav-primary nav-justified nav-theme">
                                <eq name="info.file_name" value="$now_theme">
                                    <li class="active">
                                        <a title='PC {:lang("_IN_USE_")}'><i class="icon icon-desktop"></i> <span class="pull-right"><i class="icon icon-checked"></i></span></a>
                                    </li>
                                <else/>
                                    <li>
                                        <a title='{:lang("_PC_USE_")}' data-role="use_this" data-item="pc" data-value="{$info.file_name}" title=""><i class="icon icon-desktop"></i></a>
                                    </li>
                                </eq>

                                <eq name="info.file_name" value="$now_mtheme">
                                    <li class="active">
                                     <a title='mobile {:lang("_IN_USE_")}'><i class="icon icon-mobile"></i> <span class="pull-right"><i class="icon icon-checked"></i></span></a>
                                    </li>
                                <else/>
                                    <li>
                                        <a title='{:lang("_MOBILE_USE_")}' data-role="use_this" data-item="mobile" data-value="{$info.file_name}"><i class="icon icon-mobile"></i></a>
                                    </li>
                                </eq>
                                <li>
                                 <a class="download" href="{:Url('Admin/Theme/packageDownload',array('theme'=>$info['file_name']))}" title='{:lang("_PACKAGED_DOWNLOAD_")}'><i class="icon icon-download-alt"></i></a>
                                </li>
                                <if condition="($info.file_name eq $now_theme) OR ($info.file_name eq $now_mtheme)">
                                <else/>
                                    <li class='btn-warning'>
                                        <a class="delect" href="{:Url('Admin/Theme/delete',array('theme'=>$info['file_name']))}" title='{:lang("_UNINSTALL_DELETE_")}'>
                                           <i class="icon icon-trash" ></i>
                                        </a>
                                    </li>
                                </if>
                            </ul>
                        </div>
                    </div>
                </div>
            </volist>

        </div>
        <!-- 数据列表 -->
        <!-- 分页 -->
        <div class="with-padding">
            <div class="pager">
            </div>
        </div>
    </div>
</block>
<block name="script">
    <script>
        $(function () {
            $('[data-role="use_this"]').click(function () {
                var theme = $(this).attr('data-value');
                var item = $(this).attr('data-item');
                $.post(U('Admin/Theme/setTheme'), {
                    theme: theme,
                    item:item
                }, function (msg) {
                    if (msg.status) {
                        toast.success(msg.info);
                        setTimeout(function () {
                            window.location.reload();
                        }, 1500);
                    } else {
                        handleAjax(msg);
                    }
                }, 'json');
            });
        });
    </script>
</block>
